from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, AutoEncoder
from keras.layers.convolutional import Convolution2D, MaxPooling2D, AveragePooling2D
from keras.layers import containers

def CAE_model(img_channels,img_rows,img_cols):
    encoder = containers.Sequential([Convolution2D(32, 3, 3, border_mode='same', input_shape=(img_channels,img_rows,img_cols)),
                                     Convolution2D(64, 3, 3, border_mode='same')])
    decoder = containers.Sequential([Convolution2D(32, 3, 3, border_mode='same', input_shape=(64,img_rows,img_cols)),
                                     Convolution2D(1, 3, 3, border_mode='same')])
    autoencoder = Sequential()
    autoencoder.add(AutoEncoder(encoder=encoder, decoder=decoder, output_reconstruction=True))
    autoencoder.summary()
    return autoencoder
